
import 'dart:convert';

import 'package:ichinesereader/models/common/Settings.dart';

ClassUpdateDto classUpdateDtoFromJson(String str) =>
    ClassUpdateDto.fromJson(json.decode(str));

String classUpdateDtoToJson(ClassUpdateDto data) => json.encode(data.toJson());

class ClassUpdateDto {
  ClassUpdateDto({
    this.classId,
    this.className,
    this.settings,
    this.teacherUserNames,
  });

  String? classId;
  String? className;
  Settings? settings;
  List<String>? teacherUserNames;

  factory ClassUpdateDto.fromJson(Map<String, dynamic> json) => ClassUpdateDto(
        classId: json["classId"],
        className: json["className"],
        settings: Settings.fromJson(json["settings"]),
        teacherUserNames:
            List<String>.from(json["teacherUserNames"].map((x) => x)),
      );

  Map<String, dynamic> toJson() => {
        "classId": classId,
        "className": className,
        "settings": settings != null ? settings?.toJson() : null,
        "teacherUserNames": teacherUserNames != null
            ? List<dynamic>.from(teacherUserNames!.map((x) => x))
            : null,
      };
}

// class Settings {
//     Settings({
//         this.audio,
//         this.lang,
//         this.language,
//         this.pinyin,
//         this.dictionary,
//         this.music,
//         this.quizAudio,
//     });

//     bool audio;
//     String lang;
//     String language;
//     bool pinyin;
//     bool dictionary;
//     bool music;
//     bool quizAudio;

//     factory Settings.fromJson(Map<String, dynamic> json) => Settings(
//         audio: json["audio"],
//         lang: json["lang"],
//         language: json["language"],
//         pinyin: json["pinyin"],
//         dictionary: json["dictionary"],
//         music: json["music"],
//         quizAudio: json["quizAudio"],
//     );

//     Map<String, dynamic> toJson() => {
//         "audio": audio,
//         "lang": lang,
//         "language": language,
//         "pinyin": pinyin,
//         "dictionary": dictionary,
//         "music": music,
//         "quizAudio": quizAudio,
//     };
// }
